import React,{Component} from "react"
import "./play.css"
import "./icon/iconfont.css"
import {getList1} from "../../api/api"
class Img extends Component{
	constructor(props){
		super(props)
		this.state={
			data:'',
			url:''
		}
	}
	componentWillReceiveProps(){
	}
	UNSAFE_componentWillReceiveProps(nextProps){
		let {num}=nextProps
		let {show}=nextProps
		var img = document.querySelector(".img");
		if(!show){
			img.style.display='none'
		}else{
			img.style.display='block'
		}
	    getList1(num)
	         .then(res =>{
				this.setState({
				 	url:res.data.songs[0].al.picUrl,
				})
	    })
	}
	render(){
		if(this.state.url){
			return (
				<div className="img">
				   <img src={this.state.url} className='dh'/>
				</div>
			)
		}else{
			return(
			<div className="img">
			   
			</div>
			)
		}
	}
}
export default Img








